home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / pc / ps40sdk / examples / resources / fileutilities.c < prev    next >
Text File  |  1996-06-05  |  1KB  |  69 lines

  1. /*
  2.     File: FileUtilities.c
  3.  
  4.     Copyright 1990 by Thomas Knoll.
  5.     Copyright 1993-1996 by Adobe Systems, Inc.
  6.  
  7.     C source file for file utilities.
  8. */
  9.  
  10. /*****************************************************************************/
  11.  
  12. #include "PITypes.h"
  13. #include "PIGeneral.h"
  14. #include "FileUtilities.h"
  15.  
  16. /*****************************************************************************/
  17.  
  18. void AppendStringAndString (Str255 s, Str255 append)
  19.     {
  20.     
  21.     unsigned16 sLength = s [0];
  22.     
  23.     unsigned16 totalLength = sLength + ((unsigned16) (append [0]));
  24.     
  25.     if (totalLength > 255)
  26.         totalLength = 255;
  27.         
  28.     if (totalLength > sLength)
  29.         {
  30.         BlockMove (&(append[1]), &(s[sLength+1]), totalLength - sLength);
  31.         s [0] = (unsigned char) totalLength;
  32.         }
  33.     
  34.     }
  35.  
  36. /***************************************************************************/
  37.  
  38. void AppendCharAndString (Handle h, Str255 append)
  39.     {
  40.     unsigned16 hLength = 0; // HostGetHandleSize( gStuff->handleProcs, h );
  41.     unsigned16 totalLength = hLength + ((unsigned16) (append [0]));
  42.     
  43.     if (totalLength > 255)
  44.         totalLength = 255;
  45.         
  46.     if (totalLength > hLength)
  47.         {
  48.         BlockMove (&(append[1]), &(h[0]), totalLength - hLength);
  49.         h[totalLength] = '\0';
  50.         
  51.         //BlockMove (&(append[1]), &(h[hLength+1]), totalLength - sLength);
  52.         //s [0] = totalLength;
  53.         }
  54.     
  55.     }
  56.     
  57. /*****************************************************************************/
  58.  
  59. void AppendStringAndCharacter (Str255 s, unsigned char c)
  60.     {
  61.     
  62.     if (s [0] < 255)
  63.         {
  64.         ++(s [0]);
  65.         s [s [0]] = c;
  66.         }
  67.     
  68.     }
  69.